#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion

namespace SimpleProject
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class MovingFont : DrawableGameComponent
    {
        private String mText;

        // Set the coordinates to draw the sprite at.
        private Vector2 spritePosition;

        private float rotation;
        private float direction;


        public float Rotation
        {
            get { return rotation; }
        }

        public float Direction
        {
            get { return direction; }
        }

        public Vector2 SpritePosition
        {
            get { return spritePosition; }
            set { spritePosition = value; }
        }


        public MovingFont(Game game, String EinText, Vector2 Position, float RotationSpeed)
            : base(game)
        {
            // TODO: Construct any child components here
            this.mText = EinText;
            this.spritePosition = Position;
            this.direction = RotationSpeed;
        }
        
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            rotation = 0.0f;
            base.Initialize();
        }


        protected override void LoadGraphicsContent(bool loadAllContent)
        {
            base.LoadGraphicsContent(loadAllContent);

            if (loadAllContent)
            {
            }
        }

        protected override void UnloadGraphicsContent(bool unloadAllContent)
        {
            if (unloadAllContent == true)
            {
            }
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            rotation += direction;

            base.Update(gameTime);
        }


        public override void Draw(GameTime gameTime)
        {
            // Draw the sprite.
            Game1.spriteBatch.Begin();
            Game1.spriteBatch.DrawString(Game1.Anzeige2, mText, spritePosition, Color.Gold, rotation, new Vector2(Game1.Anzeige2.MeasureString(mText).Length() / 2, Game1.Anzeige2.LineSpacing / 2), 1, SpriteEffects.None, 0);
            Game1.spriteBatch.End();
            base.Draw(gameTime);
        }
              
    }
}
